package com.eeepay.eeepay_v2.adapter;

import android.content.Context;

import com.eeepay.eeepay_v2.R;
import com.eeepay.eeepay_v2.model.LimitInfo;
import com.eeepay.eeepay_v2.util.MathUtils;
import com.eeepay.v2_library.adapter.ABBaseAdapter;
import com.eeepay.v2_library.adapter.ABViewHolder;

/**
 * Created by zw on 2016/11/30 0030.
 */
public class ServeQuotaAdapter extends ABBaseAdapter<LimitInfo>{

    public ServeQuotaAdapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_service_limit_list;
    }

    @Override
    public void convert(ABViewHolder holder, LimitInfo model) {
        holder.setRightText(R.id.lrt_limit_name, model.getServiceName());
        //银行卡种类：0-不限，1-只信用卡，2-只储蓄卡
        String cardType = "0".equals(model.getCardType()) ? "不限" :
                "1".equals(model.getCardType()) ? "信用卡" : "储蓄卡";
        holder.setRightText(R.id.lrt_limit_card_type, cardType);
        //交易时间：0-不限， 1-只工作日，2-只节假日
        String tradeTime;
        if("0".equals(model.getServiceTime())){
            tradeTime = "不限";
        }else if("1".equals(model.getServiceTime())){
            tradeTime = "工作日";
        }else if("2".equals(model.getServiceTime())){
            tradeTime = "节假日";
        }else {
            tradeTime = "";
        }
        holder.setRightText(R.id.lrt_limit_time, tradeTime);

        holder.setText(R.id.et_limit_minimum_amount, MathUtils.twoNumber(model.getMinAmount()), false);
        holder.setText(R.id.et_limit_single_largest, MathUtils.twoNumber(model.getCountAmount()), false);
        holder.setText(R.id.et_limit_single_day_largest, MathUtils.twoNumber(model.getDayAmount()), false);
        holder.setText(R.id.et_limit_day_card_largest, MathUtils.twoNumber(model.getDayCardAmount()), false);
        holder.setText(R.id.et_limit_day_card_largest_count, MathUtils.twoNumber(model.getDayCardConut()), false);

    }
}
